package BookSystem;

import BookSystem.book.BookList;
import BookSystem.user.AdminUser;
import BookSystem.user.NormalUser;
import BookSystem.user.User;

import java.util.Scanner;

/**
 * @author 兴趣使然黄小黄
 * @version 1.0
 * 图书管理系统主程序
 */
public class Main {

    public static User login(){
        System.out.println("请输入你的姓名: ");
        Scanner in = new Scanner(System.in);
        String name = in.nextLine();
        System.out.println("请输入你的身份: 1--->管理员 其他--->普通用户");
        int choice = in.nextInt();
        if (choice == 1){
            return new AdminUser(name);
        } else {
            return new NormalUser(name);
        }
    }

    public static void main(String[] args) {
        BookList bookList = new BookList();
        User user = login();
        while (true){
            int operation = user.menu();
            user.doWork(operation, bookList);
        }

    }
}
